﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AntiXSS
{
    public class AntiXSS : IPlugin.IPlugin
    {
        #region InfoPlugin

        public string[] Authors
        {
            get
            {
                return new string[] { "Manuel Fernandez" };
            }
        }

        public string Name
        {
            get
            {
                return "AntiXSS";
            }
        }

        public string Description
        {
            get
            {
                return "Protects against XSS attacks by analyzing the requests. In case it detects an XSS the packet is dropped.";
            }
        }

        public IPlugin.PluginRing Ring
        {
            get
            {
                return IPlugin.PluginRing.Ring2;
            }
        }

        #endregion

        public Model.Elements.HttpPacket Start(Model.Elements.HttpPacket packet)
        {
            /*
            if (packet is Model.Elements.HttpRequestPacket)
            {
                Model.Elements.HttpRequestPacket request = packet as Model.Elements.HttpRequestPacket;

                // < Implement some of the modsecurity rules here >
                if (request.uri.Contains("script"))
                {
                    request.dropped = true;
                    return request;
                }
            }
            */
            return packet;
        }
               
    }
}
